package com.leyu.mall.admin.goods.service.impl;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.leyu.mall.admin.goods.dao.GoodsBrandMapper;
import com.leyu.mall.admin.goods.domain.GoodsBrand;
import com.leyu.mall.admin.goods.service.IGoodsBrandService;
import com.leyu.mall.common.facade.IGoodsBrandFacade;

@Service
@Transactional(rollbackFor = Exception.class)
public class GoodsBrandServiceImpl implements IGoodsBrandService,IGoodsBrandFacade {

	@Resource(name = "goodsBrandMapper")
	private GoodsBrandMapper goodsBrandMapper;

	public GoodsBrand getGoodsBrandById(Long entity_id) throws Exception {
		return goodsBrandMapper.getGoodsBrandById(entity_id);
	}

	public void save(GoodsBrand entity) throws Exception {
		if (entity.getBrandID() == null) {
			goodsBrandMapper.addGoodsBrand(entity);

		} else {

			goodsBrandMapper.updateByPrimaryKey(entity);
		}
	}
	public void deleteGoodsBrand(Long id) throws Exception {
		goodsBrandMapper.deleteGoodsBrand(id);
	}
	public List<GoodsBrand> getAllGoodsBrand() throws Exception {
		return goodsBrandMapper.getAllGoodsBrand();

	}
	
	public List<GoodsBrand> getAllDisplayGoodsBrand() throws Exception{
		return goodsBrandMapper.getAllDisplayGoodsBrand();
	}
	
}